<template>
	<view class="boxs">
		<image src="http://youjialibo.wm76.mtnet.ren/upload/20210902/165732c2ea223e891346d97a5314d205.png"
			mode="widthFix"></image>
		<view class="listbox">
			<view class="name">
				姓名
			</view>
			<view class="inputbox">
				<input type="text" value="" placeholder="请输入您的姓名" v-model="name" />
			</view>
		</view>
		<view class="listbox">
			<view class="name">
				联系电话
			</view>
			<view class="inputbox">
				<input type="number" value="" placeholder="请输入联系电话" v-model="phone" />
			</view>
		</view>
		<view class="listbox">
			<view class="name">
				身份证
			</view>
			<view class="inputbox">
				<input type="idcard" value="" placeholder="请输入身份证号码" v-model="id_num" />
			</view>
		</view>
		<view class="listbox">
			<view class="name">
				城市
			</view>
			<view class="inputbox" @click="show = true">
				<input type="text" value="" v-model="obj.site" placeholder="请选择您所在的城市" disabled="false" />
				<view class="angle">
				</view>
			</view>
		</view>
		<view class="listbox">
			<view class="name">
				具体地址
			</view>
			<view class="inputbox">
				<input type="text" value="" placeholder="请输入具体时间" v-model="address" />
			</view>
		</view>

		<view class="listbox">
			<view class="name">
				资料上传
			</view>
		</view>
		<u-picker v-model="show" mode="region" @confirm="confirm" confirm-color="#ff3333"></u-picker>
		<!-- 上传资料 -->
		<view class="topbox">
			<view class="idbox">
				<idcardUpdate @successImg="ChooseImagez"></idcardUpdate>
				<view class="name">
					法人身份证正面
				</view>
			</view>
			<view class="idbox">
				<idcardUpdate @successImg="ChooseImagef"></idcardUpdate>
				<view class="name">
					法人身份证反面
				</view>
			</view>
		</view>

		<view class="yyzz">
			<view class="idbox">
				<idcardUpdate @successImg="ChooseImagezz"></idcardUpdate>
				<view class="name">
					营业执照
				</view>
			</view>
		</view>
		<view class="tijiao" @click="submit">
			提交申请
		</view>
	</view>
</template>

<script>
	import idcardUpdate from "../../components/idcardUpdate/index.vue"
	import {
		applyfordealer
	} from "../../api/api/index.js"
	export default {
		data() {
			return {
				show: false,
				obj: {
					site: ""
				},
				name: "",
				phone: "",
				id_num: "",
				address: "",
				id_z_img: "",
				id_m_img: "",
				license: "",
				province: "",
				city: ""
			}
		},
		methods: {
			confirm(e) {
				this.obj.site = e.province.label + e.city.label + e.area.label
				// this.province = e.province.value
				this.city = e.city.value
			},
			submit() {
				uni.showLoading({
					title: "加载中"
				})
				let data = {
					name: this.name,
					phone: this.phone,
					id_num: this.id_num,
					address: this.address,
					id_z_img: this.id_z_img,
					id_m_img: this.id_m_img,
					license:this.license,
					city:this.city
				}
				applyfordealer(data).then(res => {
					uni.hideLoading()
					uni.showToast({
						title:res.msg,
						icon:"success",
						duration:2000
					})
				})
			},
			ChooseImagez(e) {
				this.id_z_img = e
			},
			ChooseImagef(e) {
				this.id_m_img = e
			},
			ChooseImagezz(e) {
				this.license = e
			}
		},
		components: {
			idcardUpdate
		}
	}
</script>

<style scoped lang="scss">
	.boxs {
		// position: fixed;
		// top: 0;
		// left: 0;
		// right: 0;
		// bottom: 0;
		background-color: #FFFFFF;

		image {
			width: 100%;
			margin-top: -91rpx;
		}
	}

	.listbox {
		display: flex;
		margin-left: 22rpx;
		margin-bottom: 50rpx;

		.name {
			width: 104rpx;
			font-size: 26rpx;
			font-family: Microsoft YaHei;
			font-weight: 700;
			color: #000000;
			display: inline-block;
			text-align: justify;
			vertical-align: top;

			&::after {
				display: inline-block;
				width: 100%;
				content: '';
				height: 0;
			}
		}

		.inputbox {
			height: 50rpx;
			width: 580rpx;
			border-bottom: 2rpx solid #626262;
			margin-left: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			input {
				width: 410rpx;
			}

			.angle {
				width: 20rpx;
				height: 20rpx;
				border-top: 1px solid #000;
				border-left: 1px solid #000;
				transform: rotate(135deg);
			}
		}
	}

	.topbox {
		display: flex;
		align-items: center;
		justify-content: space-around;
		margin-bottom: 30rpx;

		.idbox {
			width: 324rpx;
			height: 279rpx;
			// background: #F4F8FE;
			background-color: #007AFF;
			border-radius: 10rpx;

			.name {
				width: 324rpx;
				height: 60rpx;
				background: #6699FF;
				border-radius: 0rpx 0rpx 10rpx 10rpx;
				text-align: center;
				line-height: 60rpx;
				font-size: 24rpx;
				font-family: Microsoft YaHei;
				color: #FFFFFF;
				margin-top: 11rpx;
			}
		}
	}

	.yyzz {
		margin-left: 32rpx;
		margin-bottom: 82rpx;

		.idbox {
			width: 324rpx;
			height: 279rpx;
			// background: #F4F8FE;
			background-color: #FFF5EC;
			border-radius: 10rpx;

			.name {
				width: 324rpx;
				height: 60rpx;
				background: #FF8814;
				border-radius: 0rpx 0rpx 10rpx 10rpx;
				text-align: center;
				line-height: 60rpx;
				font-size: 24rpx;
				font-family: Microsoft YaHei;
				color: #FFFFFF;
				margin-top: 11rpx;
			}
		}
	}

	.tijiao {
		width: 750rpx;
		height: 99rpx;
		background: #CD0A0A;
		line-height: 99rpx;
		text-align: center;
		font-size: 30rpx;
		font-family: Microsoft YaHei;
		color: #FFFFFF;
	}
</style>
